package com.xlh.dto.courseTest.practice;

import com.xlh.dto.courseTest.TypeReadingDTO;
import com.xlh.enums.check.SubmitStatusEnum;
import com.xlh.pojo.courseTest.Practice;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.Objects;

/**
 * @author sy
 */
@ApiModel("课程统计")
@Data
@Accessors(chain = true)
@ToString
public class PrictceCourseStatisticsDTO extends Practice {

    @ApiModelProperty(" 客观题总数 ")
    private Integer objectiveItemCount;

    @ApiModelProperty(" 客观题目出错数 ")
    private Integer objectiveItemErrorCount;


    @ApiModelProperty(" 题目总数量 ")
    private List<TypeReadingDTO> typeReadingDTOs;

    @ApiModelProperty(" 提交状态 默认已提交 ")
    private Boolean submitStatus = SubmitStatusEnum.YES.getSubmit();

    @ApiModelProperty(" 用户ID ")
    private Long userId;


    @Override
    public boolean equals(Object o) {

        PrictceCourseStatisticsDTO target = (PrictceCourseStatisticsDTO)o;
        if(this.getUserId().equals(target.getUserId()) && this.getChapterId().equals(target.getChapterId())){
            return true;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.getChapterId(), userId);
    }
}
